#include "speech_server.hpp"
//日志类参数
DEFINE_bool(log_mod,false,"true为发布模式,false为调试模式");
DEFINE_string(log_file,"","发布模式下日志存储的文件");
DEFINE_int32(log_level,0,"要输出的日志等级");
//服务注册类参数
DEFINE_string(Registery_host,"http://127.0.0.1:2379","服务注册中心地址");
DEFINE_string(base_service,"/service","服务查询的根目录");
DEFINE_string(instance_name,"/speech_service/instance","当前实例名称");
DEFINE_string(access_host,"127.0.0.1:10001","当前实例的访问地址");
//RPC调用类参数
DEFINE_int32(listen_port,10001,"RPC服务监听端口");
DEFINE_int32(timeout,-1,"RPC调用超时时长");
DEFINE_int32(rpc_threads,1,"RPC调用的IO线程数量");
//语音识别类参数
DEFINE_string(app_id,"6253207","百度云语音识别应用ID");
DEFINE_string(api_key,"vTqCJzZsCIkFu2xIMkjZZJZd","百度云语音识别平台API密钥");
DEFINE_string(secret_key,"lwJxakCG106OxRZOQLuQ1Br6Ashf2ke9","百度云语音识别平台加密密钥");



int main(int argc,char* argv[])
{
    google::ParseCommandLineFlags(&argc,&argv,true);
    zzy_mims::init_logger(FLAGS_log_mod,FLAGS_log_file,(spdlog::level::level_enum)FLAGS_log_level);
    zzy_mims::SpeechServerBuilder ssb;
    ssb.make_asr_object(FLAGS_app_id, FLAGS_api_key, FLAGS_secret_key);
    ssb.make_rpc_server(FLAGS_listen_port, FLAGS_timeout, FLAGS_rpc_threads);
    ssb.make_reg_object(FLAGS_Registery_host, FLAGS_base_service + FLAGS_instance_name, FLAGS_access_host);
    auto server = ssb.build();
    server->start();
    return 0;
}